package com.example.upload.controller;

import com.example.upload.service.VideoParseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

/**
 * VideoParseController
 *
 * @author ChenJiaGeng
 * @date 2024/10/22 10:32
 * @since 1.0.0
 */
@RestController
@RequestMapping("/parse")
public class VideoParseController {

    @Autowired
    private VideoParseService videoParseService;

    @GetMapping ("/video")
    public ResponseEntity<Map<String, Object>> uploadVideo(@RequestParam("videoLink") String videoLink) {
        String path = videoParseService.downLoadVideo(videoLink);
        Map<String, Object> response = new HashMap<>();
        response.put("success", true);
        response.put("audioUrl", path);
        return ResponseEntity.ok(response);
    }

}
